package com.chaopei.day01;

import java.util.Scanner;
/**
 *@Author Corday 天涯
 *@Date 2022/3/3 15:37
 */
public class MyGame {
    public static void main(String[] args) {
//        go();
        guessNumber();
    }
//  break与continue
    public  static  void go(){
        for(int i=100;i<130;i++){
            if(i==121){
                continue;
                //break;
            }
            System.out.print(i+" ");
        }
    }
//   实现猜数字游戏
    public  static  void guessNumber(){
        //生成键盘扫描对象
        Scanner sc = new Scanner(System.in);
        //生成100-200之间的随机数
        int num = (int)(Math.random()*100)+100;
        int temp=0;
        while (true){
            System.out.print("请猜数100-200:");
            temp = sc.nextInt();
            if(temp>num){
                System.out.println("大啦!");
            }else if(temp<num){
                System.out.println("小啦!");
            }else{
                System.out.println("获对啦!");
                break;
            }
        }
    }//guess
}
